
define(["utils","base"],function(utils,baseClass){
    var Component = function(config){
        var _this = this;
        // config.tagName = "SPAN";
        config.style = config.style||{};
        if(config.numberofline){


          numberofline = config.numberofline || 1;
        }
        Component.baseConstructor.call(this,config);
        var numberofline ;

        this.$el.addClass ("yy-text ai-center");


        this.preText = this.config.preText||"";
        this.preTextDom = $("<span class='yy-pretext'>"+this.preText+"</span>");
        if(this.config.preTextStyle){
          utils.css(this.preTextDom,this.config.preTextStyle);
        }

        this.nextText = this.config.nextText ||"";
        this.nextTextDom = $("<span class='yy-nexttext'>"+this.nextText+"</span>");
        if(this.config.nextTextStyle){
          utils.css(this.nextTextDom,this.config.nextTextStyle);
        }
        config.text = config.text === 0?"0":config.text;
        var text = (config.text||config.defaultText||"");
        var title = config.title||text;

        if (config.not_escape) {
            this.innerText = $("<span class='yy-inner-text yy-text-box'></span>");
            if(this.config.noHoverTitle===true){

            }else{
              this.innerText.attr('title', title);
            }
            this.innerText.text(text);
        } else {
            if(this.config.noHoverTitle===true){
              this.innerText = $("<span class='yy-inner-text yy-text-box'>" + text + "</span>");
            }else{
              this.innerText = $("<span title='"+title+"' class='yy-inner-text yy-text-box'>" + text + "</span>");
            }
        }

        if(numberofline){
          this.innerText[0].style["-webkit-line-clamp"]=numberofline;
          this.innerText[0].style["word-break"]="break-all";


        }
        if(this.config.textStyle){
             this.innerText.css(this.config.textStyle);
        }

        this.$el.append(this.preTextDom).append(this.innerText).append(this.nextTextDom);

    }
    utils.extendClass(Component,baseClass);
    Component.prototype.setText= function(text){
      if(this.config.noHoverTitle===true){

      }else{
        this.innerText.attr("title",text);
      }
        this.innerText.html(text);
    };
    Component.prototype.getText= function(text){
        return $.trim(this.innerText.html());
    };
    Component.prototype.setPreText= function(text){
        this.preTextDom.html(text);
    };
    Component.prototype.setNextText= function(text){
        this.nextTextDom.html(text);
    }
    return Component;
});
